/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Area_Tematica")
@NamedQueries({
    @NamedQuery(name = "AreaTematica.findAll", query = "SELECT a FROM AreaTematica a"),
    @NamedQuery(name = "AreaTematica.findByIdAreaTematica", query = "SELECT a FROM AreaTematica a WHERE a.idAreaTematica = :idAreaTematica"),
    @NamedQuery(name = "AreaTematica.findByNombre", query = "SELECT a FROM AreaTematica a WHERE a.nombre = :nombre"),
    @NamedQuery(name = "AreaTematica.findByDescripcion", query = "SELECT a FROM AreaTematica a WHERE a.descripcion = :descripcion"),
    @NamedQuery(name = "AreaTematica.findByEstado", query = "SELECT a FROM AreaTematica a WHERE a.estado = :estado")})
public class AreaTematica implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdAreaTematica")
    private Integer idAreaTematica;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Size(max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idAreaTematica", fetch = FetchType.LAZY)
    private List<Publicacion> publicacionList;

    public AreaTematica() {
    }

    public AreaTematica(Integer idAreaTematica) {
        this.idAreaTematica = idAreaTematica;
    }

    public Integer getIdAreaTematica() {
        return idAreaTematica;
    }

    public void setIdAreaTematica(Integer idAreaTematica) {
        this.idAreaTematica = idAreaTematica;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<Publicacion> getPublicacionList() {
        return publicacionList;
    }

    public void setPublicacionList(List<Publicacion> publicacionList) {
        this.publicacionList = publicacionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAreaTematica != null ? idAreaTematica.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AreaTematica)) {
            return false;
        }
        AreaTematica other = (AreaTematica) object;
        if ((this.idAreaTematica == null && other.idAreaTematica != null) || (this.idAreaTematica != null && !this.idAreaTematica.equals(other.idAreaTematica))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.AreaTematica[ idAreaTematica=" + idAreaTematica + " ]";
    }
    
}
